<extend name="Public/base" />
<block name="content">
<div id="content">
    <div id="content-header">
        <div id="breadcrumb">
            <a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i
                class="icon-home"></i> 首页</a> <a href="#" class="current">{$meta_title}</a>
        </div>
    </div>
    <div class="container-fluid">
        <br/>
        <div class="row-fluid">
            <div class="span12">
                <div class="widget-box">
                    <div class="widget-content ">
                        <form action="#" method="get" class="form-horizontal" autocomplete="off">
                            <div class="control-group">
                                <label class="control-label">短信模板名称 :</label>
                                <div class="controls">
                                    <input type="text" name="sms_template_name" maxlength="20"  class="ui-wizard-content span3" value="{$info.sms_template_name|htmlspecialchars}" />
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">可选标签:</label>
                                <label class="control-label tc"><a href="javascript:void(0)" class="js_label">[客户姓名]</a></label>
                                <label class="control-label tc"><a href="javascript:void(0)" class="js_label">[活动名称]</a></label>
                                <label class="control-label tc"><a href="javascript:void(0)" class="js_label">[活动开始时间]</a></label>
                                <label class="control-label tc"><a href="javascript:void(0)" class="js_label">[坐席名]</a></label>
                                <label class="control-label tc"><a href="javascript:void(0)" class="js_label">[坐席电话]</a></label>
                            </div>
                            <div class="control-group">
                                <label class="control-label">短信模板顶部 :</label>
                                <div class="controls">
                                    <textarea id="js_sms_template" name="sms_template_content" maxlength="60" style="width:90%; height:100px;">{$info.sms_template_content|htmlspecialchars}</textarea>
                                </div>
                            </div>
                            <div class="controls">
                                <button type="button" id="submit" class="btn btn-success">提 交</button>
                                <input type="hidden" value="{$info.sms_template_id|default=0}" name="sms_template_id">
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<style>
.tc{
	text-align: center;
}
</style>
<script type="text/javascript">
$(function(){
    //submit
    $("#submit").click(function(){
        //锁定提交按钮
        $(this).attr('disabled',true);
        var self = $('form');
        $.post("{$url}", self.serialize(), call_back, "json");
        return false;
        /**
         * @todo 接收返回值
         */
        function call_back(data){
            if(data.status == 1){
                tke_alert(data.info,'alert-success');
                setTimeout(function(){
                    location.href = data.url ;
                },1000);
            } else {
                tke_alert(data.info,'alert-error');
                $("#submit").attr('disabled',false);
            }
        }
    });
    $('.js_label').click(function(){
    	$("#js_sms_template").val($("#js_sms_template").val()+$(this).html());
    });
});

//导航高亮
highlight_subnav("{:U('Base/sms')}");
</script>
</block>